package com.tanhua.server.controller;

import com.tanhua.domain.vo.VoiceVo;
import com.tanhua.server.service.PeachblossomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")//桃子开花 桃花传音
@Slf4j
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    /**
     * 接口名称：桃花传音-发送语音（学生实战） fastDFS
     * 接口路径：POST/peachblossom
     */
    @PostMapping
    public ResponseEntity<Object> uploadVoice(MultipartFile soundFile) throws IOException {
        log.info("接口名称：桃花传音-发送语音（学生实战）");
        return peachblossomService.uploadVoice(soundFile);
    }

    /**
     * 接口名称：桃花传音-接收语音（学生实战） 随机返回一个语音
     * 接口路径：GET/peachblossom
     */
    @GetMapping
    public ResponseEntity<Object> recieveVoice() throws IOException {
        log.info("接口名称：桃花传音-发送语音（学生实战）随机返回一个语音");
        return peachblossomService.recieveVoice();
    }


}
